package com.igeek.javase.ch07.stu.dao;

import com.igeek.javase.ch07.stu.entity.Admin;
import com.igeek.javase.ch07.stu.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;

/*
 *@author wangpeng
 *2023/7/20 22:18
 *@description TODO
 */
public class AdminDao extends BaseDao<Admin>{
    //通过姓名和密码，实现登录
    public boolean login(String username , String password) throws SQLException {
        String sql = "select count(*) from admin where username = ? and password = ?";
        Long o = (Long) this.selectSingleValue(JDBCUtilsByC3P0.getConn(), sql, username, password);
        return o > 0 ? true : false;
    }
}
